﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Medianamik.Core;
using Medianamik.UI.Mediasend.NodeTypes;
using Medianamik.UI.Mediasend.Logic;

namespace Medianamik.UI.Mediasend
{
    /// <summary>
    /// Edition des configurations Mediasend
    /// </summary>
    public partial class editManagement : BaseModuleEditionPage<MediasendConfiguration>
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            
        }

        protected override string ReturnURL
        {
            get { return "mediasendManagement.aspx"; }
        }

        public override Medianamik.UI.Controls.MedianamikFormTemplate MedianamikFormTemplate
        {
            get { return Fields; }
        }

        public override LinkButton SaveButton
        {
            get { return btnSave; }
        }

        public override UpdatePanel FieldsPanel
        {
            get { return AllFieldsPanel; }
        }

        public override Guid? TypeId
        {
            get
            {
                return NodeTypes.MediasendConfiguration.TypeId; 
            }
        }

        protected override void Save(object sender, EventArgs e)
        {
            if (IsValid)
            {
                NodeManager.SaveNode(MedianamikFormTemplate.GetFormValue(CurrentNode));
                Configuration.Instance.Reset();
                Response.Redirect(ReturnURL);
            }
        }
    }
}
